<?php

/**
 * Framework_Util_HttpRequestVars
 *
 * @author Application Support Group
 * @copyright University of Georgia
 * @package BAMF
 * @filesource
*/
/**
 * Framework_Util_HttpRequestVars
 *
 * A an abstract wrapper class for classes that interact with $_GET/$_POST/$_REQUEST/$_COOKIE arrays.
 *
 * @author Application Support Group
 * @package BAMF
*/


abstract class Framework_Util_HttpRequestVars {

       /**
        * @const RETURN_NULL
        */
	const RETURN_NULL = null ;
       /**
        * @const RETURN_FALSE
        */
	const RETURN_FALSE = false ;
       /**
        * @const RETURN_ZERO
        */
	const RETURN_ZERO = 0 ;
       /**
        * @const RETURN_EMPTYSTRING
        */
	const RETURN_EMPTYSTRING = "" ;

	/**
         * @var $returnValue
	 */
	protected $returnValue ;



	public function __construct( $returns = Framework_Util_HttpRequestVars::RETURN_NULL ) {
		$this->returnValue = $returns ;
	}



	public function __destruct() {}



	abstract protected function __get( $aVar ) ;



	protected function __set( $aVar, $aVal ) {
		return false ;
	}

	public function copyToProperties( &$theNode, $fieldsToCopy = array() ) {
		foreach( $theNode->_schema[ 'fields' ] as $field ) {
			if (( in_array ( $field, $theNode->_schema[ 'fields' ] )) && ( count( $fieldsToCopy ) == 0 || in_array ( $field, $fieldsToCopy ))) {
				$theNode->$field = $this->$field ;
			}
		}
	}

	/**
	 * setReturnValue
         *
         * Alters the value returned when a _GET key is empty.
         *
	 * @param $aReturnVal the value to return.  Must evaluate to one of the class constants.
         * @return boolean True on success, False on failure.
	 */
	abstract public function setReturnValue( $aReturnVal ) ;
	
}

?>
